﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Net5ApiAndEfMySql.ApiProject.Controllers;
using Net5ApiAndEfMySql.DtoModel.Common;
using Net5ApiAndEfMySql.IService.SystemAdmin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;


namespace Net5ApiAndEfMySql.ApiProject.Controllers
{

    public class RoleDbManagerController : BaseApiController
    {
        private IRoleDbService _iRoleDbService;
        public RoleDbManagerController(IRoleDbService iRoleDbService)
        {
            _iRoleDbService = iRoleDbService;
        }

        [HttpPost]
        public ResultModel GetPageList(SearchModel m)
        {
            ResultModel result = new ResultModel();
            if (m == null)
            {
                result.code = ResultCode.Error;
                result.mess = "参数错误";
                return result;
            }
            try
            {
                var data = _iRoleDbService.GetPageList(m);

                data.draw = m.draw;
                result.code = ResultCode.Ok;
                result.data = data;
                result.mess = "成功!";
            }
            catch (Exception ex)
            {
                result.code = ResultCode.Error;
                result.mess = "错误!";
            }
            return result;

        }
       
    }
}
